<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="domain.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<jsp:useBean id="shoppingCart" scope="session"
	class="domain.ShoppingCart" />
<jsp:useBean id="user" scope="session" class="domain.User" />

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>购物车</title>
	</head>
	<style type="text/css">
.userInfo {
	float: left;
	width: 675px;
	padding-left: 10px;
	background-color: #66CC00;
}

.cart {
	
}

.goods {
	padding: 10px;
	font-family: 宋体;
	clear: both;
}

.goodsImage {
	width: 60px;
	height: 60px;
	float: left;
	border: medium;
	padding: 3px;
	background-color: #66FFFF;
}

.goodsInfo {
	padding-left: 10px;
	padding-top: 5px;
	width: 600px;
	float: left;
}

.goodsSimpleInfo {
	
}

.goodsName {
	width: 120px;
	float: left;
}

.goodsPrice {
	float: right;
	width: 120px;
}

.goodsDescription {
	color: #FF9900;
	padding-top: 5px;
	clear: both;
}

.barControl {
	clear: both;
	width: 700px;
	float: left;
	padding-top: 10px;
}

.btnSubmit {
	float: right;
}
</style>
	<body style="padding-top: 20px;">
		<div class="userInfo">
			<div style="width: 120px; float: left">
				用户:<jsp:getProperty name="user" property="userName" />
			</div>
		</div>
		<div class="cart">
			<%
				double sumPrice = 0;
				for (OrderItem orderItem : shoppingCart.getOrderItemList()) {
			%>
			<div class="goods">
				<img
					src="<%=new String(orderItem.theGoods.getImageUrl().getBytes(
						"ISO8859_1"), "utf-8")%>"
					class="goodsImage" />
				<div class="goodsInfo">
					<div class="goodsSimpleInfo">
						<div class="goodsName">
							商品名称:<%=new String(orderItem.theGoods.getName().getBytes(
						"ISO8859_1"), "utf-8")%>
						</div>
						<div class="goodsPrice">
							商品价格:<%=orderItem.theGoods.getPrice()
								* orderItem.getAmount()%>
						</div>
						<div class="goodsPrice">
							商品数量:<%=orderItem.getAmount()%>
						</div>
						<br />
						<hr style="clear: both" />
					</div>
					<div class="goodsDescription">
						<%=new String(orderItem.theGoods.getDescription()
						.getBytes("ISO8859_1"), "utf-8")%>
					</div>
				</div>
			</div>
			<%
				sumPrice += orderItem.theGoods.getPrice()
							* orderItem.getAmount();
				}
			%>
			<div class="barControl">
				<hr style="width: 675px; clear: both" />
				<form action="order" method="post">
					<div class="btnSubmit">
						<div style="width: 200px; float: left; padding-top: 5px;">
							商品总价:<%=sumPrice%>
						</div>
						<input type="submit" name="action" value="提交订单" />
					</div>
				</form>
			</div>
		</div>
	</body>
</html>

